package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeParkState;
import com.htgd.gardenexpo.dao.GeParkStateDao;
import com.htgd.gardenexpo.service.GeParkStateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeParkState)表服务实现类
 *
 * @author makejava
 * @since 2021-08-31 16:09:35
 */
@Service("geParkStateService")
public class GeParkStateServiceImpl implements GeParkStateService {
    @Resource
    private GeParkStateDao geParkStateDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeParkState queryById(Integer id) {
        return this.geParkStateDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeParkState> queryAllByLimit(int offset, int limit) {
        return this.geParkStateDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param geParkState 实例对象
     * @return 实例对象
     */
    @Override
    public GeParkState insert(GeParkState geParkState) {
        this.geParkStateDao.insert(geParkState);
        return geParkState;
    }

    /**
     * 修改数据
     *
     * @param geParkState 实例对象
     * @return 实例对象
     */
    @Override
    public GeParkState update(GeParkState geParkState) {
        this.geParkStateDao.update(geParkState);
        return this.queryById(geParkState.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geParkStateDao.deleteById(id) > 0;
    }
}
